package com.zs.blog.controller;

import com.zs.blog.model.ResponseResult;
import com.zs.blog.model.dto.GrantedDTO;
import com.zs.blog.service.IRoleAuthorityService;
import com.zs.blog.service.IRoleMenuService;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Title: RoleAuthorityController
 * @Author zs
 * @Package com.zs.blog.controller
 * @Date 2025/9/8 22:00
 * @description: 角色-菜单接口层
 */
@RestController
public class RoleMenuController {

    public IRoleMenuService roleMenuService;

    @Autowired
    public RoleMenuController(IRoleMenuService roleMenuService) {
        this.roleMenuService = roleMenuService;
    }

    @PutMapping("/admin/menu/grant")
    @Operation(summary = "更新菜单权限-分配/取消分配")
    public ResponseResult<?> grantRoleMenu(@RequestBody GrantedDTO grantedDTO){
        roleMenuService.insertOrDeleteRoleMenu(grantedDTO);
        return ResponseResult.success();
    }
}
